<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>LangChain开发你的第一个Agent | AI助手开发指南</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', 'Noto Serif SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            background-color: #f8fafc;
            line-height: 1.8;
        }
        .hero-bg {
            background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
        }
        .code-block {
            background-color: #2d2d2d;
            border-radius: 8px;
            position: relative;
        }
        .code-block:before {
            content: '';
            position: absolute;
            top: 10px;
            left: 12px;
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: #ff5f56;
            box-shadow: 20px 0 0 #ffbd2e, 40px 0 0 #27c93f;
        }
        .tool-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .section-divider {
            height: 1px;
            background: linear-gradient(90deg, transparent, rgba(0,0,0,0.1), transparent);
        }
        .dropdown-content {
            transition: all 0.3s ease;
            max-height: 0;
            overflow: hidden;
        }
        .dropdown.active .dropdown-content {
            max-height: 1000px;
            padding: 1rem 0;
        }
    </style>
</head>
<body class="antialiased">
    <!-- Hero Section -->
    <div class="hero-bg text-white py-20 px-4">
        <div class="max-w-6xl mx-auto">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0 md:pr-10">
                    <h1 class="text-4xl md:text-5xl font-bold mb-6 leading-tight">LangChain开发你的第一个 Agent</h1>
                    <p class="text-xl mb-8 text-blue-100">像《钢铁侠》中贾维斯一样，在半小时内打造属于你的AI助手</p>
                    <div class="flex space-x-4">
                        <a href="#getting-started" class="bg-white text-blue-600 px-6 py-3 rounded-lg font-medium hover:bg-blue-50 transition duration-300">开始构建</a>
                        <a href="#core-components" class="border-2 border-white text-white px-6 py-3 rounded-lg font-medium hover:bg-white hover:text-blue-600 transition duration-300">了解核心组件</a>
                    </div>
                </div>
                <div class="md:w-1/2">
                    <img src="https://cdn.nlark.com/yuque/0/2025/png/21449790/1752204308964-d3961b4e-0e80-4712-b67e-a735bb38f230.png" alt="LangChain Agent概念图" class="rounded-xl shadow-2xl border-4 border-white">
                </div>
            </div>
        </div>
    </div>

    <!-- Main Content -->
    <div class="max-w-6xl mx-auto px-4 py-12">
        <!-- Intro Section -->
        <section class="mb-20">
            <p class="text-lg text-gray-700 mb-8">还记得《钢铁侠》中贾维斯的智能助手形象吗？如今，借助LangChain框架，你也能在短短半小时内打造属于自己的AI助手。不需要深厚的机器学习背景，只要几十行代码，你就能创建一个能查询网络、分析数据、回答问题的智能Agent。</p>
            
            <!-- Concept Diagram -->
            <div class="my-12">
                <div class="mermaid">
                    graph TD
                        A[用户] -->|输入问题| B(Agent)
                        B --> C{思考决策}
                        C -->|需要计算| D[计算工具]
                        C -->|需要查询| E[网络搜索]
                        C -->|需要记忆| F[记忆系统]
                        D --> B
                        E --> B
                        F --> B
                        B -->|输出答案| A
                </div>
                <p class="text-center text-gray-500 mt-2">图1: LangChain Agent工作原理示意图</p>
            </div>
        </section>

        <!-- Section 1 -->
        <section id="langchain-agent" class="mb-20">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-b pb-4 flex items-center">
                <i class="fas fa-robot text-blue-500 mr-3"></i>
                LangChain与Agent
            </h2>

            <div class="grid md:grid-cols-2 gap-8">
                <!-- What is LangChain -->
                <div class="bg-white p-6 rounded-xl shadow-md hover:shadow-lg transition duration-300">
                    <h3 class="text-xl font-semibold mb-4 text-blue-600 flex items-center">
                        <i class="fas fa-cubes mr-2"></i>
                        什么是LangChain
                    </h3>
                    <p class="text-gray-700 mb-4">LangChain是一个强大的框架，它让开发者能够轻松构建基于大语言模型(LLM)的应用。就像乐高积木一样，LangChain提供了各种可组合的组件，让你能够快速搭建复杂的AI应用。</p>
                    <div class="code-block p-4 text-gray-200 overflow-x-auto">
                        <pre><code>// 导入LangChain核心组件
import { ChatOpenAI } from "langchain/chat_models/openai";
import { ChatPromptTemplate } from "langchain/prompts";

// 初始化LLM
const llm = new ChatOpenAI({ 
  temperature: 0.7,
  openAIApiKey: "你的API密钥" 
});</code></pre>
                    </div>
                </div>

                <!-- Agent Nature -->
                <div class="bg-white p-6 rounded-xl shadow-md hover:shadow-lg transition duration-300">
                    <h3 class="text-xl font-semibold mb-4 text-purple-600 flex items-center">
                        <i class="fas fa-brain mr-2"></i>
                        Agent的本质
                    </h3>
                    <p class="text-gray-700 mb-4">Agent不仅仅是一个能对话的AI，更是一个能够"思考-决策-行动"的智能体。想象一下，如果普通的LLM是一个只会回答问题的图书管理员，那Agent就是一个能够查阅资料、使用工具、解决问题的私人助理。</p>
                    <div class="flex items-center p-3 bg-purple-50 rounded-lg">
                        <i class="fas fa-lightbulb text-purple-500 text-2xl mr-3"></i>
                        <span class="text-purple-700">Agent的核心在于它能够根据用户的需求，自主决定使用什么工具，以什么顺序执行任务。</span>
                    </div>
                </div>
            </div>

            <!-- Why LangChain -->
            <div class="mt-8 bg-blue-50 p-6 rounded-xl">
                <h3 class="text-xl font-semibold mb-4 text-blue-700 flex items-center">
                    <i class="fas fa-star mr-2"></i>
                    为什么选择LangChain开发Agent？
                </h3>
                <div class="grid md:grid-cols-4 gap-4">
                    <div class="bg-white p-4 rounded-lg shadow">
                        <i class="fas fa-puzzle-piece text-blue-500 text-2xl mb-2"></i>
                        <p class="font-medium">简化的工具集成</p>
                    </div>
                    <div class="bg-white p-4 rounded-lg shadow">
                        <i class="fas fa-sliders-h text-blue-500 text-2xl mb-2"></i>
                        <p class="font-medium">灵活的Agent类型</p>
                    </div>
                    <div class="bg-white p-4 rounded-lg shadow">
                        <i class="fas fa-memory text-blue-500 text-2xl mb-2"></i>
                        <p class="font-medium">记忆管理机制</p>
                    </div>
                    <div class="bg-white p-4 rounded-lg shadow">
                        <i class="fas fa-bug text-blue-500 text-2xl mb-2"></i>
                        <p class="font-medium">调试与监控功能</p>
                    </div>
                </div>
                <p class="mt-4 text-blue-800">与从零开始构建相比，使用LangChain可以将开发时间从数周缩短到数小时。</p>
            </div>

            <!-- Env Setup -->
            <div class="mt-8">
                <h3 class="text-xl font-semibold mb-4 text-gray-700 flex items-center">
                    <i class="fas fa-laptop-code mr-2"></i>
                    开发环境准备
                </h3>
                <div class="code-block p-4 text-gray-200 overflow-x-auto">
                    <pre><code># 创建项目目录
mkdir my-first-agent
cd my-first-agent

# 初始化项目
npm init -y

# 安装依赖
npm install langchain @langchain/openai

# 创建入口文件
touch index.ts</code></pre>
                </div>
            </div>
        </section>

        <!-- Section 2 -->
        <section id="core-components" class="mb-20">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-b pb-4 flex items-center">
                <i class="fas fa-puzzle-piece text-orange-500 mr-3"></i>
                Agent的核心组件
            </h2>

            <div class="grid md:grid-cols-3 gap-6">
                <!-- LLM Selection -->
                <div class="bg-white p-6 rounded-xl shadow-md hover:shadow-lg transition duration-300">
                    <h3 class="text-xl font-semibold mb-4 text-orange-600 flex items-center">
                        <i class="fas fa-robot mr-2"></i>
                        LLM模型选择
                    </h3>
                    <p class="text-gray-700 mb-4">Agent的"大脑"是LLM模型，选择合适的模型至关重要。对于入门级Agent，推荐使用OpenAI的gpt-3.5-turbo或gpt-4。</p>
                    <div class="code-block p-4 text-gray-200 overflow-x-auto text-sm">
                        <pre><code>import { ChatOpenAI } from "langchain/chat_models/openai";

// 初始化不同的LLM模型
const fastModel = new ChatOpenAI({ 
  modelName: "gpt-3.5-turbo",
  temperature: 0.7 
});

const smartModel = new ChatOpenAI({ 
  modelName: "gpt-4",
  temperature: 0.2 
});</code></pre>
                    </div>
                </div>

                <!-- Tools -->
                <div class="bg-white p-6 rounded-xl shadow-md hover:shadow-lg transition duration-300">
                    <h3 class="text-xl font-semibold mb-4 text-green-600 flex items-center">
                        <i class="fas fa-tools mr-2"></i>
                        扩展Agent能力的关键
                    </h3>
                    <p class="text-gray-700 mb-4">工具(Tools)是Agent与外部世界交互的桥梁。没有工具的Agent就像被关在笼子里的AI，只能基于已知信息回答问题。</p>
                    <div class="code-block p-4 text-gray-200 overflow-x-auto text-sm">
                        <pre><code>import { DynamicTool } from "langchain/tools";

// 创建一个简单的天气查询工具
const weatherTool = new DynamicTool({
  name: "getCurrentWeather",
  description: "获取指定城市的当前天气情况",
  func: async (city: string) => {
    return `${city}当前天气：晴朗，温度25°C，湿度60%`;
  },
});</code></pre>
                    </div>
                </div>

                <!-- Memory -->
                <div class="bg-white p-6 rounded-xl shadow-md hover:shadow-lg transition duration-300">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                        <i class="fas fa-brain mr-2"></i>
                        让你的Agent具有上下文理解能力
                    </h3>
                    <p class="text-gray-700 mb-4">记忆机制让Agent能够"记住"之前的对话，从而提供连贯的交互体验：</p>
                    <div class="code-block p-4 text-gray-200 overflow-x-auto text-sm">
                        <pre><code>import { BufferMemory } from "langchain/memory";

// 创建简单的缓冲记忆
const memory = new BufferMemory({
  returnMessages: true,
  memoryKey: "chat_history",
});</code></pre>
                    </div>
                </div>
            </div>
        </section>

        <!-- Section 3 -->
        <section id="first-agent" class="mb-20">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-b pb-4 flex items-center">
                <i class="fas fa-magic text-red-500 mr-3"></i>
                第一个Agent的诞生
            </h2>

            <!-- Project Structure -->
            <div class="mb-12">
                <h3 class="text-xl font-semibold mb-4 text-gray-700 flex items-center">
                    <i class="fas fa-folder-open mr-2"></i>
                    项目结构设计
                </h3>
                <div class="bg-gray-800 text-gray-200 p-4 rounded-lg overflow-x-auto">
                    <pre><code>my-first-agent/
├── index.ts         # 入口文件
├── tools/           # 自定义工具目录
│   ├── weather.ts   # 天气查询工具
│   └── calculator.ts # 计算工具
├── config.ts        # 配置文件
└── package.json</code></pre>
                </div>
            </div>

            <!-- Core Implementation -->
            <div class="mb-12">
                <h3 class="text-xl font-semibold mb-4 text-gray-700 flex items-center">
                    <i class="fas fa-code mr-2"></i>
                    核心代码实现
                </h3>
                <p class="text-gray-700 mb-4">下面是创建一个简单Agent的完整代码：</p>
                <div class="code-block p-4 text-gray-200 overflow-x-auto">
                    <pre><code>import { ChatOpenAI } from "langchain/chat_models/openai";
import { initializeAgentExecutorWithOptions } from "langchain/agents";
import { Calculator } from "langchain/tools/calculator";
import { WebBrowser } from "langchain/tools/webbrowser";
import { BufferMemory } from "langchain/memory";

async function main() {
  // 初始化LLM
  const model = new ChatOpenAI({ temperature: 0 });
  
  // 准备工具
  const tools = [
    new Calculator(),
    new WebBrowser({ model }),
  ];
  
  // 配置记忆
  const memory = new BufferMemory({
    returnMessages: true,
    memoryKey: "chat_history",
  });
  
  // 创建Agent执行器
  const executor = await initializeAgentExecutorWithOptions(
    tools,
    model,
    {
      agentType: "chat-conversational-react-description",
      memory,
      verbose: true,
    }
  );
  
  // 执行查询
  const result = await executor.invoke({ 
    input: "计算23乘以45是多少，然后帮我查询一下北京今天的天气" 
  });
  
  console.log(result.output);
}

main();</code></pre>
                </div>
            </div>

            <!-- Custom Tools -->
            <div class="mb-12">
                <h3 class="text-xl font-semibold mb-4 text-gray-700 flex items-center">
                    <i class="fas fa-wrench mr-2"></i>
                    自定义工具开发
                </h3>
                <p class="text-gray-700 mb-4">自定义工具让你的Agent拥有独特能力：</p>
                <div class="grid md:grid-cols-2 gap-6">
                    <div class="code-block p-4 text-gray-200 overflow-x-auto">
                        <pre><code>// 创建一个文件读取工具
const fileReaderTool = new DynamicTool({
  name: "FileReader",
  description: "读取指定路径的文本文件内容",
  func: async (filePath: string) => {
    try {
      const content = fs.readFileSync(filePath, "utf-8");
      return content;
    } catch (error) {
      return `读取文件失败: ${error.message}`;
    }
  },
});</code></pre>
                    </div>
                    <div class="code-block p-4 text-gray-200 overflow-x-auto">
                        <pre><code>// 创建一个简单的翻译工具
const translationTool = new DynamicTool({
  name: "Translator",
  description: "将文本从一种语言翻译到另一种语言",
  func: async (input: string) => {
    // 格式: "文本|源语言|目标语言"
    const [text, from, to] = input.split("|");
    
    // 简单模拟一下结果
    return `已将文本从${from}翻译成${to}: ${text}翻译结果`;
  },
});</code></pre>
                    </div>
                </div>
            </div>
        </section>

        <!-- Section 4 -->
        <section id="improving-agent" class="mb-20">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-b pb-4 flex items-center">
                <i class="fas fa-chart-line text-teal-500 mr-3"></i>
                让你的Agent更聪明
            </h2>

            <!-- Thinking Chain -->
            <div class="mb-12">
                <h3 class="text-xl font-semibold mb-4 text-teal-600 flex items-center">
                    <i class="fas fa-project-diagram mr-2"></i>
                    提升Agent推理能力
                </h3>
                <p class="text-gray-700 mb-4">链式思考(Chain of Thought)是提升Agent推理能力的关键技术：</p>
                <div class="code-block p-4 text-gray-200 overflow-x-auto">
                    <pre><code>import { ChatOpenAI } from "langchain/chat_models/openai";
import { ChatPromptTemplate, HumanMessagePromptTemplate } from "langchain/prompts";

// 创建一个引导链式思考的提示模板
const promptTemplate = ChatPromptTemplate.fromPromptMessages([
  HumanMessagePromptTemplate.fromTemplate(
    "请一步步思考以下问题:\n{question}\n\n让我们先分析问题，然后逐步推导答案。"
  ),
]);

const llm = new ChatOpenAI({ temperature: 0 });

// 创建链式思考链
const chain = promptTemplate.pipe(llm);

// 执行复杂推理
const response = await chain.invoke({
  question: "如果一个项目需要8人完成10天，那么4人完成同样的项目需要多少天？",
});

console.log(response);</code></pre>
                </div>
            </div>

            <!-- Persistent Memory -->
            <div class="mb-12">
                <h3 class="text-xl font-semibold mb-4 text-purple-600 flex items-center">
                    <i class="fas fa-history mr-2"></i>
                    Agent如何"记住"历史对话
                </h3>
                <p class="text-gray-700 mb-4">持久化记忆让Agent能够长期记住用户偏好和历史交互：</p>
                <div class="code-block p-4 text-gray-200 overflow-x-auto">
                    <pre><code>import { ChatOpenAI } from "langchain/chat_models/openai";
import { initializeAgentExecutorWithOptions } from "langchain/agents";
import { Calculator } from "langchain/tools/calculator";
import { MongoDBChatMessageHistory } from "langchain/stores/message/mongodb";
import { BufferMemory } from "langchain/memory";

async function createAgentWithPersistentMemory(userId: string) {
  // 创建MongoDB消息存储
  const messageHistory = new MongoDBChatMessageHistory({
    collection: database.collection("chatHistory"),
    sessionId: userId,
  });
  
  // 基于持久化存储创建记忆
  const memory = new BufferMemory({
    chatHistory: messageHistory,
    returnMessages: true,
    memoryKey: "chat_history",
  });
  
  const model = new ChatOpenAI({ temperature: 0 });
  const tools = [new Calculator()];
  
  // 创建Agent执行器
  return await initializeAgentExecutorWithOptions(
    tools,
    model,
    {
      agentType: "chat-conversational-react-description",
      memory,
      verbose: true,
    }
  );
}

// 使用示例
const userId = "user123";
const agent = await createAgentWithPersistentMemory(userId);

// 即使应用重启，Agent也能记住之前的对话
const result = await agent.invoke({ 
  input: "我昨天问你的问题，你还记得吗？" 
});</code></pre>
                </div>
            </div>
        </section>

        <!-- Section 5 -->
        <section id="real-world-applications">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-b pb-4 flex items-center">
                <i class="fas fa-globe text-blue-500 mr-3"></i>
                Agent的现实应用
            </h2>

            <!-- Application Cards -->
            <div class="grid md:grid-cols-3 gap-8">
                <!-- Personal Assistant -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden hover:shadow-lg transition duration-300">
                    <div class="bg-blue-600 p-4 text-white">
                        <h3 class="text-xl font-semibold flex items-center">
                            <i class="fas fa-calendar-alt mr-2"></i>
                            日程管理与信息检索
                        </h3>
                    </div>
                    <div class="p-6">
                        <p class="text-gray-700 mb-4">个人助理Agent可以帮助管理日程和检索信息：</p>
                        <div class="code-block p-4 text-gray-200 overflow-x-auto text-sm">
                            <pre><code>// 日程管理工具
const calendarTool = new DynamicTool({
  name: "Calendar",
  description: "管理用户的日程安排",
  func: async (input: string) => {
    // 解析指令
    const [action, ...params] = input.split("|");
    // 实现逻辑...
  },
});</code></pre>
                        </div>
                        <div class="mt-4 flex">
                            <span class="inline-block bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded mr-2">日程管理</span>
                            <span class="inline-block bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">信息检索</span>
                        </div>
                    </div>
                </div>

                <!-- Data Analysis -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden hover:shadow-lg transition duration-300">
                    <div class="bg-green-600 p-4 text-white">
                        <h3 class="text-xl font-semibold flex items-center">
                            <i class="fas fa-chart-bar mr-2"></i>
                            从数据中提取洞见
                        </h3>
                    </div>
                    <div class="p-6">
                        <p class="text-gray-700 mb-4">数据分析助手可以帮助用户理解复杂数据：</p>
                        <div class="code-block p-4 text-gray-200 overflow-x-auto text-sm">
                            <pre><code>// 数据分析工具
const dataAnalysisTool = new DynamicTool({
  name: "DataAnalysis",
  description: "对加载的数据进行统计分析",
  func: async (analysisType: string) => {
    // 模拟不同类型的分析
    if (analysisType.includes("趋势")) {
      return "销售趋势分析...";
    }
    // 其他分析...
  },
});</code></pre>
                        </div>
                        <div class="mt-4 flex">
                            <span class="inline-block bg-green-100 text-green-800 text-xs px-2 py-1 rounded mr-2">数据分析</span>
                            <span class="inline-block bg-green-100 text-green-800 text-xs px-2 py-1 rounded">商业智能</span>
                        </div>
                    </div>
                </div>

                <!-- Customer Service -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden hover:shadow-lg transition duration-300">
                    <div class="bg-purple-600 p-4 text-white">
                        <h3 class="text-xl font-semibold flex items-center">
                            <i class="fas fa-headset mr-2"></i>
                            提升用户体验的智能对话
                        </h3>
                    </div>
                    <div class="p-6">
                        <p class="text-gray-700 mb-4">客服机器人可以提供24/7的用户支持：</p>
                        <div class="code-block p-4 text-gray-200 overflow-x-auto text-sm">
                            <pre><code>// 知识库查询工具
const knowledgeBaseTool = new DynamicTool({
  name: "KnowledgeBase",
  description: "查询产品知识库获取信息",
  func: async (query: string) => {
    // 模拟知识库查询
    if (query.includes("退款")) {
      return "退款政策: ...";
    }
    // 其他查询...
  },
});</code></pre>
                        </div>
                        <div class="mt-4 flex">
                            <span class="inline-block bg-purple-100 text-purple-800 text-xs px-2 py-1 rounded mr-2">客户服务</span>
                            <span class="inline-block bg-purple-100 text-purple-800 text-xs px-2 py-1 rounded">智能问答</span>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Conclusion -->
            <div class="mt-12 bg-gradient-to-r from-blue-50 to-purple-50 p-8 rounded-xl border border-gray-200">
                <h3 class="text-2xl font-bold mb-4 text-gray-800">开启你的Agent开发之旅</h3>
                <p class="text-gray-700 mb-6">通过以上实例，我们看到LangChain Agent在各种场景中的强大应用潜力。从个人助理到数据分析，再到客户服务，Agent都能提供智能化的解决方案。随着你对LangChain的深入了解，你可以构建更复杂、更强大的Agent来满足各种需求。</p>
                <a href="#getting-started" class="bg-blue-600 text-white px-6 py-3 rounded-lg font-medium hover:bg-blue-700 transition duration-300 inline-flex items-center">
                    <i class="fas fa-rocket mr-2"></i>
                    立即开始你的第一个Agent项目
                </a>
            </div>
        </section>
    </div>

    <script>
        // Initialize Mermaid
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });

        // Dropdown functionality
        document.querySelectorAll('.dropdown-toggle').forEach(toggle => {
            toggle.addEventListener('click', () => {
                const dropdown = toggle.closest('.dropdown');
                dropdown.classList.toggle('active');
            });
        });

        // Smooth scrolling for anchor links
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>